package com.jinlia.show.modules.system.controller;

import com.jinlia.show.modules.base.system.entity.MdArticle;
import com.jinlia.show.modules.base.system.service.MdArticleMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mk/article")
public class MdArticleController {

    @Autowired
    private MdArticleMapperService mdArticleMapperService;
    @PostMapping("/list")
    public List<MdArticle> list(@RequestBody MdArticle swiperImgs){
        List<MdArticle> list = mdArticleMapperService.list();
        return list;
    }

    @PostMapping("/rename")
    public Boolean renameArticle(@RequestBody MdArticle mdArticle){
        mdArticleMapperService.renameArticle(mdArticle);
        return Boolean.TRUE;
    }


    @PostMapping("/new")
    public MdArticle newMdArticle(@RequestBody MdArticle mdArticle){
        mdArticleMapperService.save(mdArticle);
        return mdArticle;
    }
    @PostMapping("/saveOrUpdate")
    public MdArticle saveOrUpdate(@RequestBody MdArticle mdArticle){
        mdArticleMapperService.saveOrUpdate(mdArticle);
        return mdArticle;
    }
}
